﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DaInterFace;
using DaInterFace.XMode;

namespace DaFunction.XMode
{
    internal class XMode : IXMode
    {
        public event MessageHandler MessageEvent;

        public IDataBase Data { get { return data; } }
        public ISerializer Serializer { get { return serial; } }
        public IConfig Config { get { return config; } }

        private IDataBase data;
        private ISerializer serial;
        private IConfig config;

        public XMode(IDataBase data, IConfig config)
        {
            this.data = data;
            this.serial = new XModeSerializer();
            this.config = new XModeConfig(config);
        }

        public void Message(MessageType type, String note)
        {
            Message(type, note, 0);
        }

        public void Message(MessageType type, String note, Double span)
        {
            if (MessageEvent != null)
            {
                MessageEvent.Invoke(type, note, span);
            }
        }
    }
}
